//package org.brakepedal.server.support.aspect;
//
//import com.corundumstudio.socketio.SocketIOClient;
//import com.corundumstudio.socketio.annotation.OnEvent;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.AfterThrowing;
//import org.aspectj.lang.annotation.Aspect;
//import org.brakepedal.server.support.exception.BusinessException;
//import org.springframework.stereotype.Component;
//
///**
// * Date: 2024/4/9 11:17
// *
// * @author Huanyu Mark
// */
//@Aspect
//@Component
//public class BusinessExceptionReporter {
//    @AfterThrowing(throwing = "e",
//            pointcut = "execution(* org.brakepedal.server.controller..*.*(..)) && @annotation(com.corundumstudio.socketio.annotation.OnEvent)",
//            argNames = "e,joinPoint")
//    public void report(BusinessException e, JoinPoint joinPoint){
//        var client = find(joinPoint);
//    }
//
//    private SocketIOClient find(JoinPoint joinPoint){
//        for (Object clientLike : joinPoint.getArgs()) {
//            if(clientLike instanceof SocketIOClient client) {
//                return client;
//            }
//        }
//        throw new IllegalArgumentException("No SocketIOClient found in Method '"+joinPoint.getSignature()+"'");
//    }
//}
